package com.itfreer.data.report;

import java.util.List;



import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.transform.Transformers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.itfreer.data.report.dao.BaseReportDao;

/**
 * 定义表单下标准Service实现基类
 */
@Transactional(readOnly = false)
public abstract class JdbcBaseReportDaoImp implements  BaseReportDao {
	
	@Autowired
	protected SessionFactory sessionFactory;

	@SuppressWarnings("deprecation")
	@Override
	public List<?> getReportData(String sql) {
		Session session = this.sessionFactory.getCurrentSession();
		List<?> list =  session.createNativeQuery(sql).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list();
		return list;
	}
	
	
}